SYNTAXDEF amtscript
FOR <edu.pku.sei.amt>

START Transformation

OPTIONS {
	reloadGeneratorModel = "true";
	usePredefinedTokens = "false"; 
	
}

TOKENS {
	DEFINE IDENTIFIER $('A'..'Z'|'a'..'z'|'_')('_'|'A'..'Z'|'a'..'z'|'0'..'9')*$;
	DEFINE KEYFEATURENAME $('!'|'@')$+IDENTIFIER;//! property, @ opposite property
	DEFINE URI $'<'('A'..'Z'|'a'..'z'|'0'..'9'|'/'|'\\'|':'|'.')+'>'$;
    DEFINE EXPR $'['(' '|'A'..'Z'|'a'..'z'|'0'..'9'|'_'|'-'|'+'|'*'|'/'|'='|'>'|'<'|'!'|'('|')'|'{'|'}'|':'|'\''|'\|'|','|'.')+']'$;
    DEFINE LINEBREAK $('\r\n'|'\r'|'\n')$; 
	DEFINE WHITESPACE $(' '|'\t'|'\f')$;
}

RULES {
	// syntax definition for class 'StartMetaClass'
	Transformation   ::= "transformation" name[IDENTIFIER] (parameters ("," parameters)*)? keys* rules*;
	TypedModel ::= name[IDENTIFIER] ":" uri[URI];
	Key ::= "key" className[IDENTIFIER] ":" (featureNames[KEYFEATURENAME])+ ";";
	Rule ::= "rule" (modifiers[IDENTIFIER])* name[IDENTIFIER] "{" (variables ";")* sections*"}";
	ObjectVariable ::= name[IDENTIFIER] ":" scope[IDENTIFIER] "::" type[IDENTIFIER];
	PrimitiveVariable ::= name[IDENTIFIER] ":" type[IDENTIFIER] ;
	Section ::= (modifiers[IDENTIFIER])* ("for" modelName[IDENTIFIER])? "{" (referredVariables[IDENTIFIER] ("," referredVariables[IDENTIFIER])* ";")?  (links ("," links)* ";")?   (expressions[EXPR] ";")* sections* "}" ;
	LinkConstraint ::= source[IDENTIFIER] "." refName[IDENTIFIER] "=" target[IDENTIFIER] ;
}